package com.smedi.ismedi.inmail.core.port.adapter.persistence.repository.impl;

import com.smedi.ismedi.authority.starter.util.VerifyHelper;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.LoginLog;
import com.smedi.ismedi.inmail.core.domain.aggregatemodel.OperationLog;
import com.smedi.ismedi.inmail.core.domain.repository.LoginLogRepository;
import com.smedi.ismedi.inmail.core.domain.repository.OperationLogRepository;
import com.smedi.ismedi.inmail.core.port.adapter.convert.AdapterConverter;
import com.smedi.ismedi.inmail.core.port.adapter.persistence.model.LoginLogEntity;
import com.smedi.ismedi.inmail.core.port.adapter.persistence.model.OperationLogEntity;
import com.smedi.ismedi.inmail.core.port.adapter.persistence.mybatis.mapper.LoginLogMapper;
import com.smedi.ismedi.inmail.core.port.adapter.persistence.mybatis.mapper.OperationLogMapper;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Repository;

/**
 * 主体院关系实现类
 *
 * @author niuyanling
 * @date 2021/08/05
 */
@Repository
@AllArgsConstructor
public class OperationLogRepositoryImpl implements OperationLogRepository {
    private final AdapterConverter adapterConverter;

    private final OperationLogMapper operationLogMapper;

    @Override
    public Long create(OperationLog operationLog) {
        OperationLogEntity operationLogEntity = adapterConverter.operationLogToOperationLogEntity(operationLog);
        operationLogMapper.insert(operationLogEntity);
        return operationLogEntity.getId();
    }
}